<%= javascript_include_tag "jquery/jquery.form.js" %>
<form enctype="multipart/form-data" method="post" action="/content/upload_image" id="uploadForm">
   <input type="file" name="file"/>
   <input type="text" name="desc" class="text"/> 
   <%= submit_tag "上传", :class => "submit" %>
   <span id="uploadOutput"></span>
</form>


<script>
	$(document).ready(function(){
		$('#uploadForm').ajaxForm({
        beforeSubmit: function(a,f,o) {
            o.dataType = "html";
            $('#uploadOutput').html('文件上传中,请稍等...');
        },
        success: function(data) {
            $("#files").append(data)
            $('#uploadOutput').html("");
            $("input[name='file']").val("");
        }
    });
	});
</script>
